#include "ASUtil.h"

#if defined(AS_RUN_ON_SKY)
#include "mrc_exb.h"
#endif
/*short term timer*/
ASINT as_create_timer(ASINT millsecs, as_timer_cb cb)
{
#if defined(AS_RUN_ON_MRE)
    return vm_create_timer(millsecs, cb);
#elif defined(AS_RUN_ON_SKY)
    ASINT tid = mrc_timerCreate();
    mrc_timerStart(tid, millsecs, 0, cb, ASTRUE);
    return tid;
#endif
}
ASVOID as_destroy_timer(ASINT tid)
{
#if defined(AS_RUN_ON_MRE)
    vm_delete_timer(tid);
#elif defined(AS_RUN_ON_SKY)
    mrc_timerStop(tid);
    mrc_timerDelete(tid);
#endif
}

/*long term timer*/
//ASINT as_create_timer_ex(ASINT millsecs,as_timer_cb cb)
//{
//#if defined(AS_RUN_ON_MRE)
//    return vm_create_timer_ex(millsecs,cb);
//#elif defined(AS_RUN_ON_SKY)
//
//#endif
//}
//ASVOID as_destroy_timer_ex(ASINT tid)
//{
//#if defined(AS_RUN_ON_MRE)
//    vm_delete_timer_ex(tid);
//#elif defined(AS_RUN_ON_SKY)
//
//#endif
//}

ASVOID as_get_phone_type(ASINT* if_touch, ASINT* if_keybrd)
{
#if defined(AS_RUN_ON_MRE)
#elif defined(AS_RUN_ON_SKY)
    ASINT tag = mrc_isTouchSupport();

    if(tag % 10 == 0)
    {
        *if_touch = ASFALSE;
        *if_keybrd = ASTRUE;
    }
    else if(tag % 10 == 1)
    {
        *if_touch = ASTRUE;
        *if_keybrd = ASTRUE;
    }
    else if(tag % 10 == 2)
    {
        *if_touch = ASTRUE;
        *if_keybrd = ASFALSE;
    }

#endif
}

ASBOOL as_if_has_simcard(ASVOID)
{
#if defined(AS_RUN_ON_MRE)
#elif defined(AS_RUN_ON_SKY)

    if(mrc_getNetworkID() == MR_NET_ID_NONE)
        return ASFALSE;
    else
        return ASTRUE;

#endif
}